#include "car.h"
#include <iostream>
#include <sstream>

Car::Car() {}

void Car::input(bool debug, int index) {
    if (debug) {
        std::ostringstream oss;
        oss << "cqusn202209" << (1000+index);
        id = oss.str();
        chassis.id = "dp2022" + std::to_string(1000+index);
        chassis.tires = { {"公路轮", "175mm"}, {"公路轮", "175mm"}, {"麦克纳姆轮", "175mm"}, {"麦克纳姆轮", "175mm"} };
    } else {
        std::cout << "请输入小车编号（cqusn打头16位）：";
        std::cin >> id;
        std::cout << "请输入底盘编号（dp打头8位）：";
        std::cin >> chassis.id;
        chassis.tires.clear();
        for (int i = 0; i < 4; ++i) {
            Tire t;
            std::cout << "请输入第" << i+1 << "个轮胎类型（公路轮/麦克纳姆轮）：";
            std::cin >> t.type;
            t.size = "175mm";
            chassis.tires.push_back(t);
        }
    }
}

void Car::inputBasicInfo(int index, bool isDebug) {
    if (isDebug) {
        std::ostringstream oss;
        oss << "cqusn202209" << (1000+index);
        id = oss.str();
        chassis.id = "dp2022" + std::to_string(1000+index);
    } else {
        std::cout << "请输入小车编号（cqusn打头16位）：";
        std::cin >> id;
        std::cout << "请输入底盘编号（dp打头8位）：";
        std::cin >> chassis.id;
    }
    // 设置默认轮胎
    chassis.tires = { {"公路轮", "175mm"}, {"公路轮", "175mm"}, {"麦克纳姆轮", "175mm"}, {"麦克纳姆轮", "175mm"} };
}
